#if !defined(__APP_MQTT_H)
#define __APP_MQTT_H

#include "MQTTClient.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "log/log.h"

#define ADDRESS "ws://192.168.16.34:1883"
#define CLIENTID "b253ba38-daf6-4b37-984f-5d8fdc6a1cfa"
#define TOPIC_RTG "remote_to_gateway"
#define TOPIC_GTR "gateway_to_remote"
#define QOS 1
#define TIMEOUT 10000L


/**
 * @brief MQTT客户端初始化
 * 
 * @return int 
 */
int app_mqtt_init(void);

/**
 * @brief MQTT客户端发送数据
 * 
 * @param msg 
 * @return int 
 */
int app_mqtt_send(char *msg);

/**
 * @brief MQTT客户端关闭
 * 
 * @return int 
 */
void app_mqtt_close(void);

/**
 * @brief 注册用来处理远程消息的回调函数
 * 
 * @param callback 
 */
void app_mqtt_registerRecvCallback(int (*callback)(char *json));
#endif // __APP_MQTT_H
